/*******************************************************************************
 * Copyright (c) 2012 Daniele Parisi.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     Daniele Parisi
 *     neb.inf@gmail.com
 *     http://www.danieleparisi.com/
 ******************************************************************************/
package org.jxreport.core.views.chart.pie;

import java.util.LinkedList;
import java.util.List;

import org.jxreport.core.Table;
import org.jxreport.core.XMLValues;
import org.jxreport.core.views.chart.ChartView;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class PieChartView extends ChartView {

	List<Series> series = new LinkedList<Series>();
	
	public PieChartView(Element viewElement, Table table) {
		super(viewElement, table);
		
		NodeList nl = viewElement.getElementsByTagName(XMLValues.PIE_SERIES);
		for(int i = 0 ; i < nl.getLength();i++) {
			Element el = (Element)nl.item(i);
			this.series.add(new Series(el));
		}
		
		 nl = viewElement.getElementsByTagName(XMLValues.DATA_SERIES);
			for(int i = 0 ; i < nl.getLength();i++) {
				Element el = (Element)nl.item(i);
				this.series.add(new Series(el, table));
			}
	}

	public List<Series> getSeries() {
		return series;
	}

	public void setSeries(List<Series> values) {
		this.series = values;
	}
}
